package com.qianyu.project.web.controller.smj;

import com.qianyu.project.entity.Fragmentary;
import com.qianyu.project.entity.LaborContract;
import com.qianyu.project.service.smj.smjFragmentaryService;
import com.qianyu.project.utils.Result;
import com.qianyu.project.utils.ResultTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/smj_fragmentary")
public class smjFragmentaryController {
    @Autowired
    private smjFragmentaryService fs;

    @GetMapping("")
    public String AddFragmentary(String apply_date,String p_id,String type,String handler_id,String comment,String attach_ids){
        return fs.AddFragmentary( apply_date, p_id, type, handler_id, comment, attach_ids);
    }

    @GetMapping("/AddWorkList")
    public void AddWorkList(String fragmentary_id,String work_content,String unit,String unit_price,String number){
         fs.AddWorkList( fragmentary_id, work_content, unit, unit_price, number);
    }

    @PostMapping("Flow_Fragmentary")
    public Integer FlowFragmentary(@RequestBody Fragmentary fragmentary){
        return  fs.FlowFragmentary(fragmentary);
    }

    @GetMapping("/ListFragmentary")
    public Result ListFragmentary(@RequestParam Map<String,String> params){
        Map<String, Object> map =new HashMap<>();
        //查询合同
        map.put("data", fs.ListFragmentary(params));
        return ResultTool.success(map);
    }

    @GetMapping("/getWorkList")
    public List<Map<String,Object>> getWorkList(String fragmentary_id){
       return fs.getWorkList(fragmentary_id);
    }

    @GetMapping("/getfromaudit")
    public List<Map<String,Object>> getfromaudit(String id){
        return fs.getfromaudit(id);
    }
}
